package com.gxa.admin.controller;

import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.PageRecv;
import com.gxa.common.vo.R;
import com.gxa.modules.pojo.Loan;
import com.gxa.modules.pojo.Remind;
import com.gxa.modules.service.ExpiringService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.models.auth.In;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 即将到期
 */
@Api(value = "即将到期接口",tags = "即将到期接口API")
@Controller
@RequestMapping("/expiring")
public class ExpiringController {
     @Autowired
    private ExpiringService expiringService;
    @GetMapping("/queryLoanZ")
    @ResponseBody
    @ApiOperation(value = "即将到期查询接口",notes = "查询即将到期",httpMethod = "GET", response = JsonResult.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
   //@RequiresPermissions("/home/duto")
    public JsonResult queryLoanZ(Integer page ,Integer limit){
        return expiringService.queryLoanZ(page,limit);
    }

    @PostMapping("/queryLoanZList")
    @ResponseBody
    @ApiOperation(value = "即将到期查询接口",notes = "查询即将到期",httpMethod = "POST", response = JsonResult.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })

    public JsonResult queryLoanZList( @RequestBody PageRecv<Loan> pageRecv){
        System.out.println(pageRecv);
        return expiringService.queryLoanZList(pageRecv);
    }

    @PostMapping("/updateExpiring")
    @ResponseBody
    @ApiOperation(value = "到期提醒接口",notes = "添加或者修改到期提醒",httpMethod = "POST", response = JsonResult.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
   //@RequiresPermissions("/home/dueremind")
    public JsonResult  updateExpiring( @RequestBody Remind remind){
        return expiringService.updateExpiring(remind);
    }
}
